package b;

public class ShowPicture extends Thread{
    public Picture picture;

    public ShowPicture(){}

    public ShowPicture(Picture picture) {
        this.picture = picture;
    }

    @Override
    public void run() {
        System.out.println("等待加载完成...");
        synchronized (picture){
            if (!picture.isLoad){//没有加载完成  等待
                try {
                    picture.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }


        System.out.println("显示图片");

        System.out.println("显示完成");
        picture.isShow=true;
        synchronized (picture){
            picture.notify();//显示完成  就唤醒下载图片
        }
    }
}
